/*
 * @Author: Seven
 * @Date: 2021-11-28 21:06:20
 * @LastEditors: Seven
 * @LastEditTime: 2021-11-28 21:13:54
 * @FilePath: \def-standard\src\store\modules\web3.js
 * @Description: 存储web3的一些状态变量
 */
const web3State = {
    state: () => ({
      web3: null,
      web3Connected: false,
      //当地账户地址
      currentAccount: null,
      //当前网络
      currentNetwork: null,
      //保存网络ID 对应的网络，用来区分在测试网还是正式网
      netWorkMap: { '1': "ETH", '3': "Ropsten", '42': "Kovan", '4': "Rinkeby", '5': "Goerli", '97': "BSC Testnet" },
      tokenBalance: 0,
      bnbBalance: 0,
      blockNumber: 0,
      singleMiningConfig: {
        30: { day: 30, rate: 1.5, balance: 0, capacity: 0, unLockTime: 0 },
        60: { day: 60, rate: 2, balance: 0, capacity: 0, unLockTime: 0 },
        90: { day: 90, rate: 2.5, balance: 0, capacity: 0, unLockTime: 0 },
        180: { day: 180, rate: 3, balance: 0, capacity: 0, unLockTime: 0 },
      },
    }),
    mutations: {
      set_web3_state(state, item) {
        let key = Object.keys(item)[0]
        state[key] = item[key]
      }
    },
  }
  
  export default web3State